using System.Globalization;

namespace RenameX.Rules
{
    public class CaseTransformRule : RuleBase
    {
        public override string Name => "大小写转换";

        public enum CaseMode { None, Upper, Lower, Title, FirstUpper }

        private CaseMode _mode = CaseMode.None;
        public CaseMode Mode { get => _mode; set => SetProperty(ref _mode, value); }

        public override string Apply(string originalName)
        {
            return Mode switch
            {
                CaseMode.Upper => originalName.ToUpperInvariant(),
                CaseMode.Lower => originalName.ToLowerInvariant(),
                CaseMode.Title => CultureInfo.InvariantCulture.TextInfo.ToTitleCase(originalName.ToLowerInvariant()),
                CaseMode.FirstUpper => originalName.Length > 0 ? char.ToUpperInvariant(originalName[0]) + originalName.Substring(1) : originalName,
                _ => originalName
            };
        }
    }
}


